/*************************************************************************
 *
 *  Copyright (C) 2013 Florian Dang <florian.coin@gmail.com>
 *
 *  This file is part of NatusVerse.
 *
 *  NatusVerse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  NatusVerse is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NatusVerse.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************/

#ifndef INC_IMAGE_IMAGE_H_
#define INC_IMAGE_IMAGE_H_

/*!
 * \file        image.h
 * \brief       PGM and PPM images processing
 * \author      Florian Dang
 * \date        2013
 *
 */

#include <string>
#include <vector>

/*! \namespace image
 *
 * Namespace for image processing. Render PGM and PPM formats.
 */
namespace image
{

static const float MAX_INTENSITY=255.0f;

typedef enum
{
	PGM,
	PPM
} t_format;


//! Image processing class
/*!
	Render PGM and PPM formats.
*/
class Img
{
	public:
		Img(std::vector<float> vimg):
			vimg_(vimg), w_(0), h_(0), format_(PGM) {};

		Img(std::vector<float> vimg, int w, int h, t_format format):
			vimg_(vimg), w_(w), h_(h), format_(format) {};

		~Img() {};

		std::vector<float> &GetVect();

		float *GetArray(); // not good...

		float &GetPixel(int idx);

		t_format &GetFormat();

		int &GetWidth();

		int &GetHeight();

		int GetSize();

		int GetStep();

		int Save(std::string filename);

	private:
		/**
		 * Array, width, height, format
		 */
		std::vector<float>	vimg_;
		int		            w_;
		int		            h_;
		t_format	        format_;

};

}

#endif  // INC_IMAGE_IMAGE_H_
